package oppty_status

import (
	"context"
	"git.mycaigou.com/gfyx/common/tenant_db"
	"time"
)

type GfyxOpptyStatusHistoryRepos struct {
	tenant_db.TenantDB
}

func NewOpptyStatusHistoryRepos() GfyxOpptyStatusHistoryReposIface {
	return &GfyxOpptyStatusHistoryRepos{}
}

func (g *GfyxOpptyStatusHistoryRepos) SaveOpptyStatusHistory(ctx context.Context, data *GfyxOpptyStatusHistory) error {
	data.CreatedOn = time.Now()
	data.ModifiedOn = time.Now()
	db := g.GetTenantDB(ctx).Create(data)
	if db.Error != nil {
		return db.Error
	}
	return nil
}
